#!/bin/bash
echo "Building Complete GUI AI System..."
echo

WXWIN="/d/vc/wxWidgets-3.2.7"

echo "1. Building Chat Window..."
g++ -std=c++11 -O2 -Wall -Wextra \
    -I"$WXWIN/include" \
    -I"$WXWIN/lib/wx/include/msw-unicode-3.2" \
    -D__WXMSW__ -D_UNICODE -DUNICODE \
    src/ai_chat_frame.cpp \
    -L"$WXWIN/lib" \
    -lwxmsw32u_core_gcc_custom -lwxbase32u_gcc_custom \
    -lwxmsw32u_adv_gcc_custom \
    -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 \
    -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid \
    -lcomctl32 -lrpcrt4 -loleacc -luxtheme \
    -o ai_chat_window.exe

if [[ $? -eq 0 ]]; then
    echo "✅ Chat window built: ai_chat_window.exe"
else
    echo "❌ Chat window build failed"
    exit 1
fi

echo "2. Building Unified Launcher..."
g++ -std=c++11 -O2 -Wall -Wextra \
    -I"$WXWIN/include" \
    -I"$WXWIN/lib/wx/include/msw-unicode-3.2" \
    -D__WXMSW__ -D_UNICODE -DUNICODE \
    src/unified_launcher.cpp \
    -L"$WXWIN/lib" \
    -lwxmsw32u_core_gcc_custom -lwxbase32u_gcc_custom \
    -lkernel32 -luser32 -lgdi32 \
    -o ai_launcher.exe

if [[ $? -eq 0 ]]; then
    echo "✅ Unified launcher built: ai_launcher.exe"
else
    echo "❌ Unified launcher build failed"
fi

# 设置 PATH
export PATH="$WXWIN/lib:$PATH"

echo
echo "🎉 Complete GUI AI System Ready!"
echo
echo "Available Executables:"
echo "  ./ai_chat_window.exe    - Graphical chat window"
echo "  ./ai_launcher.exe       - Unified launcher"
echo "  ./cbp2make_ai.exe       - Console AI system"
echo
echo "Quick Start:"
echo "  ./ai_chat_window.exe          # Start chat window directly"
echo "  ./ai_launcher.exe --gui       # Start via launcher"
echo "  ./ai_launcher.exe --console   # Console mode"
echo
echo "💡 The chat window provides:"
echo "  - 👤 Human to AI communication"
echo "  - 🤖 AI to Computer commands"  
echo "  - 💬 Direct terminal access"
echo "  - 🎨 Colored message display"
echo "  - ⏰ Timestamped conversations"
